/** @file gui_image.h
    @brief A widget that shows an image */

#ifndef G3_GUI_IMAGE_H
#define G3_GUI_IMAGE_H

#include "gui/gui_widget.h"

namespace G3 {
namespace GUI {

/** @class IMAGE
    @brief An image widget class */
class IMAGE: public WIDGET {
	public:
        /**
            @brief A constructor
        */
		IMAGE ();

        /**
            @brief A destructor
        */
		virtual ~IMAGE () {
			FrameVisible = false;
		}

        /** The color of the image frame */
		COL4F Color;
		/** Is the frame visible ? */
		bool FrameVisible;
        /** Image texture handle */
        H_TEXTURE Image;

		IMAGE& operator= (const IMAGE &aImage);

        /**
            @brief Creates the group
            @param[in] aRect Reference to the group rectangle
            @param[in] aTex Handle of the image texture
        */
		void Create (const RECTI &aRect, H_TEXTURE aTex);

        /**
            @brief Sets group dimensions
            @param[in] aRect Reference to the new rectangle
        */
		void SetRect (const RECTI &aRect);

        /**
            @brief Sets the texture of the image widget
            @param[in] aTex Texture handle
        */
		void SetImage (H_TEXTURE aTex);

        /**
            @brief Shows the frame
        */
		void ShowFrame () { FrameVisible = true; }
        /**
            @brief Hides the frame
        */
		void HideFrame () { FrameVisible = false; }

        /**
            @brief Draws the image
            @param[in] aElapsedTime The elapsed time since the last call
        */
		void Draw (float aElapsedTime = 0.0f);

        /**
            @brief Gets the type of this widget
            @return The type index \see TYPE_MANAGER
        */
		virtual uint GetType () { return MainTypeMgr.GetType ("W_IMAGE"); }

        /**
            @brief Is this widget static ?
            @return True.
        */
		virtual bool IsStatic () { return true; }
};

}
}

#endif // G3_GUI_IMAGE_H
